package com.xbongbong.paas.model.impl;

import com.xbongbong.paas.enums.DelEnum;
import com.xbongbong.paas.model.SearchCustomerCompanyModel;
import com.xbongbong.paas.toolbox.util.DateUtil;
import com.xbongbong.pro.domain.dao.SearchCustomerCompanyDao;
import com.xbongbong.pro.domain.entity.SearchCustomerCompanyEntity;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @Author shian
 * @create 2019-08-07 16:00
 * @Description
 */
@Service("searchCustomerCompanyModel")
public class SearchCustomerCompanyModelImpl implements SearchCustomerCompanyModel {

    @Resource
    private SearchCustomerCompanyDao searchCustomerCompanyDao;

    @Override
    public Integer insert(SearchCustomerCompanyEntity entity){
        long now = DateUtil.getInt();
        entity.setAddTime(now);
        entity.setUpdateTime(now);
        entity.setDel(DelEnum.NORMAL.getDel());
        return searchCustomerCompanyDao.insert(entity);
    }

    @Override
    public Integer update(SearchCustomerCompanyEntity entity){
        return searchCustomerCompanyDao.update(entity);
    }

    @Override
    public List<SearchCustomerCompanyEntity> findEntitys(Map<String, Object> param) {
        return searchCustomerCompanyDao.findEntitys(param);
    }

    @Override
    public List<SearchCustomerCompanyEntity> getListByCorpid(String corpid) {
        return searchCustomerCompanyDao.getListByCorpid(corpid);
    }

    @Override
    public SearchCustomerCompanyEntity getByCorpid(String corpid, int type) {
        return searchCustomerCompanyDao.getByCorpid(corpid, type);
    }

    @Override
    public List<String> getCorpidList() {
        return searchCustomerCompanyDao.getCorpidList();
    }

    @Override
    public List<String> getCorpidListWithType(int type) {
        return searchCustomerCompanyDao.getCorpidListWithType(type);
    }

    @Override
    public void saveSoukeMeal(SearchCustomerCompanyEntity entity) {
        if (entity.getId() == null || entity.getId() == 0L) {
            insert(entity);
        } else {
            update(entity);
        }
    }

    @Override
    public void updateBatch(List<SearchCustomerCompanyEntity> companyList) {
        searchCustomerCompanyDao.updateBatch(companyList);
    }

    @Override
    public Integer getEntitysCount(Map<String, Object> param) {
        return null;
    }

    @Override
    public List findEntitysWithoutSub(Map<String, Object> param) {
        return null;
    }
}
